package com.example.leetcode.test;

import java.util.Arrays;
import java.util.Objects;
import java.util.Scanner;

public class TextUtil {


    public static void printScanner() {
        Scanner scanner = new Scanner(System.in);
        String s = scanner.nextLine();
        if (Objects.nonNull(s)) {
            String symbol = getSymbol(s);
            if (symbol == null) {
                System.out.println("输入的文本格式不对");
            }else {
                Arrays.stream(s.split(symbol)).map(Integer::parseInt).sorted().forEach(System.out::println);
            }
        }
    }


    private static String getSymbol(String s) {
        for (int i = 0; i < s.length(); i++) {
            char c = s.charAt(i);
            if (c == ' ') {
                return " ";
            }
            if (c == ',') {
                return ",";
            }
            if (c == ';') {
                return ";";
            }
        }
        return null;
    }


    public static void main(String[] args) {
        TextUtil.printScanner();
    }
}
